"""Make figure showing population over time."""
import argparse
import hashlib
import os
import pickle

import matplotlib.pyplot as plt
import matplotlib.style
import matplotlib.ticker
import numpy as np
import pandas as pd
import scipy.special

import datasets
import inference

parser = argparse.ArgumentParser()
parser.add_argument('output_filename', help='Output path for figure.')

# use seaborn style globally
matplotlib.style.use('seaborn-deep')


def make_plot(output_filename):
    df = datasets._population_british_isles()
    fig = plt.figure()  # noqa
    ax = plt.gca()
    df.loc[1820:1919].plot(ax=ax)
    plt.title('UK and Ireland Population, 1820-1919')
    ax.xaxis.set_minor_locator(matplotlib.ticker.AutoMinorLocator())
    ax.yaxis.set_minor_locator(matplotlib.ticker.AutoMinorLocator())
    plt.savefig(output_filename)
    print('saved plot to file:', output_filename)


if __name__ == '__main__':
    args = parser.parse_args()
    make_plot(args.output_filename)
